package com.example.crossoriginserver.config;

import com.example.crossoriginserver.filter.CrossOriginFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 配置统一过滤器
 * @author wanghaiyang
 * @date 2018/4/9 15:07
 */
@Configuration
public class FilterConfig {


    @Bean
    public FilterRegistrationBean filterRegistrationBean() {
        FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
        filterRegistrationBean.addUrlPatterns("/*");
        filterRegistrationBean.setFilter(new CrossOriginFilter());

        return filterRegistrationBean;
    }

}
